extends Node2D


func _ready():
	randomize()
	pass

func summon_hen():
	var Hen = load("res://object/Hen.tscn").instance()
	Hen.position = cal_rand_pos()
	add_child(Hen)
	
func cal_rand_pos():
	var randx = rand_range(0,1280)
	var randy = rand_range(0,720)
	return Vector2(randx,randy) 
	pass
	
func summon_bugs():
	var Bug = load("res://object/bug.tscn").instance()
	Bug.position = cal_rand_pos()
	add_child(Bug)
	pass
	
func _on_back_pressed():
	get_tree().paused = false
	$Panel.hide()
	pass


func _on_back2_pressed():
	get_tree().paused = false
	get_tree().change_scene("res://Main.tscn")
	pass 


func _on_pause_pressed():
	$Panel.show()
	get_tree().paused = true
	pass 


func _on_BugTimer_timeout():
	summon_bugs()
	pass # Replace with function body.


func _on_HenTimer2_timeout():
	summon_hen()
	pass # Replace with function body.
